package com.bookcloud.java21.chapter4.类的方法44;

public class MethodExamples {
  // 无参数无返回值
  public void method1() {
    System.out.println("无参数无返回值");
  }

  // 有参数无返回值
  public void method2(int a) {
    System.out.println("有参数无返回值,参数：" + a);
  }

  // 有参数有返回值
  public int method3(int a, int b) {
    return a + b;
  }

  // 静态方法
  public static void method4(String str) {
    System.out.println("静态方法,参数：" + str);
  }

  // 重载
  public void method5(int a, int b) {
    System.out.println("2个重载方法,参数：" + a + "," + b);
  }

  public void method5(int a, int b, int c) {
    System.out.println("3个重载方法,参数：" + a + "," + b + "," + c);
  }

  public void method5(String str1, String str2) {
    System.out.println("2个重载方法(字符类型）,参数：" + str1 + "," + str2);
  }
}
